package com.haoxin.ai_course.common.utils;


import java.io.Serializable;

import io.micrometer.core.instrument.util.StringUtils;
import io.swagger.annotations.ApiModelProperty;


/**
 * 响应结果类
 *
 * @param <T>
 * @author Administrator
 */
public class HttpJsonResult<T> implements Serializable {

    private static final long serialVersionUID = 1L;
    /**
     * 0 成功 1 失败
     */
    @ApiModelProperty("调用结果响应码，0为成功，其他为失败")
    
    private Integer code = 0;
    @ApiModelProperty("返回数据，可能为空")
    private T data;
    @ApiModelProperty("返回消息")
    private String msg;
    private Long count = 0l;
    // private String token;

    public HttpJsonResult() {
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        if (StringUtils.isNotEmpty(msg)){
            code = 1;
        }
        this.msg = msg;
    }

    public void setErrMsg(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }
//
//  public String getToken() {
//    return token;
//  }
//
//  public void setToken(String token) {
//    this.token = token;
//  }
}
